package com.cskaoyan.market.service;

import com.cskaoyan.market.db.domain.MarketAdmin;
import com.cskaoyan.market.db.domain.MarketAdminExample;
import com.cskaoyan.market.db.mapper.MarketAdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author lixianbiao
 * @since 2024/06/28 18:43
 */

@Service
public class AdminAuthServiceImpl implements AdminAuthService{
    @Autowired
    private MarketAdminMapper adminMapper;
    @Override
    public MarketAdmin login(MarketAdmin marketAdmin) {
        MarketAdminExample adminExample = new MarketAdminExample();
        MarketAdminExample.Criteria criteria = adminExample.createCriteria();
        criteria.andUsernameEqualTo(marketAdmin.getUsername());
        criteria.andPasswordEqualTo(marketAdmin.getPassword());
        marketAdmin = adminMapper.selectOneByExample(adminExample);
        return marketAdmin;
    }
}